package cn.edu.nju.software.zp13.core.validator;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

public class XmlErrorHandler implements ErrorHandler{

	@Override
	public void warning(SAXParseException exception) throws SAXException {
		printErrorMsg(exception);
	}

	@Override
	public void error(SAXParseException exception) throws SAXException {
		printErrorMsg(exception);
	}

	@Override
	public void fatalError(SAXParseException exception) throws SAXException {
		printErrorMsg(exception);
	}
	
	private void printErrorMsg(SAXParseException e){
		System.err.println(e.getMessage());
		System.exit(0);
	}
	
}
